#include "instruct.h"
#include "register.h"
#include "def.h"
#include <stdio.h>
int pushIsRun(char opt){
	if(opt==PUSH){
		return 2;
	}
	return 0;
}
int pushParseRun(Register*R){
	char*code=R->code;
    int pc=R->RPC;
    char opt=code[pc];
    if(opt==PUSH){
        char r1=code[pc+1];
        u32 num=0;
        if(r1==AX){
            num=R->RAX;
        }else if(r1==BX){
            num=R->RBX;
        }else if(r1==CX){
            num=R->RCX;
        }else if(r1==DX){
            num=R->RDX;
        }else if(r1==EX){
            num=R->REX;
        }else if(r1==BP){
            num=R->RBP;
        }else if(r1==SS){
            num=R->RSS;
        }else if(r1==SP){
            num=R->RSP;
        }
        code[R->RSS+R->RSP+0]=num&0xFF;
        code[R->RSS+R->RSP+1]=(num>>8)&0xFF;
        code[R->RSS+R->RSP+2]=(num>>16)&0xFF;
        code[R->RSS+R->RSP+3]=(num>>24)&0xFF;
        //数据入栈
        R->RSP+=4;
    }
	
    R->RPC+=pushIsRun(opt);
	return 0;
}